package com.nidu.demo.menu.dto;

import com.nidu.demo.base.BaseCmd;
import com.nidu.demo.common.enums.MenuTypeEnum;
import com.nidu.demo.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 菜单添加命令
 *
 * @author auto
 */
@Data
@Schema(description = "菜单添加命令")
@EqualsAndHashCode(callSuper = true)
public class MenuAddCmd extends BaseCmd {

    /**
     * 菜单名称
     */
    @NotBlank(message = "菜单名称不能为空")
    @Size(max = 64, message = "菜单名称长度不能超过64个字符")
    @Schema(description = "菜单名称", example = "系统管理")
    private String menuName;

    /**
     * 菜单类型(1:目录,2:菜单,3:按钮)
     */
    @NotNull(message = "菜单类型不能为空")
    @Schema(description = "菜单类型(1:目录,2:菜单,3:按钮)", example = "1")
    @InEnum(MenuTypeEnum.class)
    private Integer menuType;

    @Size(max = 200, message = "权限标识长度不能超过200个字符")
    @Schema(description = "菜单权限标识", example = "system:manage")
    private String permission;

    /**
     * 父菜单ID
     */
    @Schema(description = "父菜单ID", example = "0")
    private Long parentId;

    /**
     * 图标
     */
    @Size(max = 100, message = "图标长度不能超过100个字符")
    @Schema(description = "图标", example = "system")
    private String icon;

    /**
     * 图标类型(1:icon,2:本地icon)
     */
    @NotNull(message = "菜单类型不能为空")
    @Schema(description = "菜单类型(1:目录,2:菜单,3:按钮)", example = "1")
    private Integer iconType;

    /**
     * 路由名称
     */
    @Size(max = 200, message = "路由名称长度不能超过200个字符")
    @Schema(description = "路由名称", example = "system")
    private String routeName;

    /**
     * 路由路径
     */
    @Size(max = 200, message = "路由路径长度不能超过200个字符")
    @Schema(description = "路由路径", example = "/system")
    private String routePath;

    /**
     * 组件路径
     */
    @Size(max = 200, message = "组件路径长度不能超过200个字符")
    @Schema(description = "组件路径", example = "system/index")
    private String component;

    /**
     * 国际化Key
     */
    @Size(max = 200, message = "国际化Key长度不能超过200个字符")
    @Schema(description = "国际化Key", example = "route.user.label")
    private String i18nKey;

    /**
     * 外部链接
     */
    @Schema(description = "外部链接", example = "https://baidu.com")
    private String href;

    /**
     * 重定向路径
     */
    @Schema(description = "重定向路径", example = "system/user/index")
    private String redirect;

    /**
     * 是否可见
     */
    @Schema(description = "是否可见", example = "false")
    private Boolean visible;

    /**
     * 是否缓存
     */
    @Schema(description = "是否缓存", example = "false")
    private Boolean isCache;

}